package com.yue.ssa.service.impl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yue.ssa.bean.Menu;
import com.yue.ssa.bean.RespBean;
import com.yue.ssa.mapper.MenuMapper;
import com.yue.ssa.service.MenuService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author zhengyl
 * @description
 * @date 2020-04-08 9:34
 */
@Service
@Transactional
public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements MenuService {

    @Override
    public List<Menu> getMenusByUid(String uid) {
        return this.baseMapper.getMenusByUid(uid);
    }

    @Override
    public List<Menu> getMenusByRid(String rid) {
        return this.baseMapper.getMenusByRid(rid);
    }

    @Override
    public RespBean getLeafMenus() {
        Map<String, Object> params = new HashMap<>();
        params.put("leaf", true);
        return RespBean.ok(this.listByMap(params));
    }
}
